package com.kzw.config;

import javax.annotation.Resource;
import javax.servlet.Filter;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.SecurityConfigurerAdapter;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.web.DefaultSecurityFilterChain;

@Configuration
public class PermitAllSecurityConfig extends SecurityConfigurerAdapter<DefaultSecurityFilterChain, HttpSecurity> {

	@Resource
	private Filter uriFormatFilter;

	@Bean
	public FilterRegistrationBean<Filter> setFilter() {
		FilterRegistrationBean<Filter> filterBean = new FilterRegistrationBean<>();
		filterBean.setFilter(uriFormatFilter);
		filterBean.setName("uriFormatFilter");
		filterBean.addUrlPatterns("/*");
		filterBean.setOrder(-10000);
		return filterBean;
	}

}
